import request from '@/utils/request'

// 登录
export function login(phone, password, businessId, pubDomainBusinessId, userId) {
  const params = {}
  params.phone = phone
  params.password = password
  params.businessId = businessId
  params.scope = 'pubDomainBusiness'
  params.pubDomainBusinessId = pubDomainBusinessId
  params.userId = userId
  return request({
    url: '/uaa/admin/login',
    method: 'post',
    data: params
  })
}
// 登陆之前获取选择公域商户列表
export function getLoginBusinessList(phone, password) {
  const params = {}
  params.phone = phone
  params.password = password
  return request({
    url: '/uaa/admin/getLoginBusinessList',
    method: 'post',
    data: params
  })
}

// 获取用户信息
export function getInfo(data) {
  return request({
    url: '/business_admin/user/user_info_menus?isPubDomainUser=true',
    method: 'get',
    params: {}
  })
}

// 修改密码
export function modifyPw(data) {
  return request({
    url: '/business_admin/user/modify_pw',
    method: 'post',
    data: data
  })
}

// 检查超级账号密码
export function checkSuperPwd(password) {
  return request({
    url: '/business_admin/user/check_super_pwd',
    method: 'post',
    data: { password }
  })
}

// 退出
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

/**
 * 微信绑定 微信登录相关
 */

// 获取绑定二维码
export function bindWx(data) {
  return request({
    url: '/business_admin/user/wx/bind',
    method: 'post',
    data: data
  })
}

// 解除微信绑定
export function unBindWx(data) {
  return request({
    url: '/business_admin/user/wx/unbind_wx',
    method: 'post',
    data: data
  })
}

// 查询绑定微信状态
export function checkBindWxState(params) {
  return request({
    url: '/business_admin/user/wx/query_bind_state',
    method: 'get',
    params: params
  })
}

// 获取微信登录二维码
export function wxLoginQrCode(data) {
  return request({
    url: '/uaa/admin/gen_wx_login_qrcode',
    method: 'post',
    data: data
  })
}

// 查询微信登录状态
export function checkWxLoginState(data) {
  return request({
    url: '/uaa/admin/query_wx_login_state',
    method: 'post',
    data: data
  })
}

// 微信登录
export function wxLogin(data) {
  return request({
    url: '/uaa/admin/wx_login',
    method: 'post',
    data: data
  })
}
